const KoaRouter = require('@koa/router')
const { verifyAuth } = require('../middleware/login.middleware')
const { create, reply, remove } = require('../controller/comment.controller')
const { verifyPermission } = require('../middleware/permission.middleware')

// 1.定义路由对象
const commentRouter = new KoaRouter({ prefix: "/comment" })

// 2.具体路由规则
// 发表评论
commentRouter.post('/createComment', verifyAuth, create)
// 回复评论
commentRouter.post('/replyComment', verifyAuth, reply)
// 删除评论
commentRouter.delete('/removeComment/:commentId', verifyAuth, verifyPermission, remove)

module.exports = commentRouter